{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "583288ba",
   "metadata": {},
   "source": [
    "# 本周内容"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "43b67199",
   "metadata": {},
   "source": [
    "## 1.人脸识别概念和基础"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "42b7967e",
   "metadata": {},
   "source": [
    "## 2.人脸识别应用"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "968e6577",
   "metadata": {},
   "source": [
    "## 3.人脸识别实践-face++\n",
    "> 1.人脸检测\n",
    "> 2.人脸对比+人类搜索\n",
    ">> 1. 人类集合创建\n",
    ">> 2. 人脸"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1123ac56",
   "metadata": {},
   "source": [
    "# 人脸识别概念和基础"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "aa3cdc7e",
   "metadata": {},
   "outputs": [],
   "source": [
    "# encoding:utf-8\n",
    "\n",
    "import requests\n",
    "import base64\n",
    "\n",
    "'''\n",
    "Face++ 人脸检测\n",
    "'''\n",
    "\n",
    "request_url = \"https://api-cn.faceplusplus.com/facepp/v3/detect\"\n",
    "# 二进制方式打开图片文件\n",
    "# 1.图片文件准备\n",
    "f = open('cxk.jpg', 'rb')\n",
    "img = base64.b64encode(f.read())\n",
    "\n",
    "# 2. 酬载准备\n",
    "payload = {\n",
    "    'api_key':'fQfBhzqD4IFg-XpYsfNrtQMj-V_xQnZ6',\n",
    "    'api_secret':'IOBHCcpHCKbXX98_5sUYf2Uh62qF3YpM',\n",
    "    'image_base64':img,\n",
    "    'return_attributes':'gender,age,smiling,headpose,facequality,emotion,blur,beauty'\n",
    "}\n",
    "\n",
    "headers = {'content-type': 'application/x-www-form-urlencoded'}\n",
    "response = requests.post(request_url, data = payload, headers=headers)\n",
    "if response:\n",
    "    print (response.json())\n",
    "else:\n",
    "    print(response.status_code)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "532d3ad8",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
